<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>点餐系统</title>
    <style>



        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100vh;
        }

        .login-container {
            background-color: rgba(255, 255, 255, 0.8); /* 背景色透明度，可根据需要调整 */
            padding: 40px;
            border-radius: 8px;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
            text-align: center;
            margin: auto; /* 居中 */
            overflow: hidden; /* 防止内容溢出 */

            background-image: url('../static/img/mkl.jpg');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat; /* 防止图片重复 */
            height: 100vh; /* 降低高度，使布局看起来更均衡 */
            width: 100%;
            display: flex;
            flex-direction: column; /* 竖直布局 */
            align-items: center;
            justify-content: center;
            border: 10px solid rgba(255, 255, 255, 0.5); /* 透明边框 */
        }

        h1 {
            color: #333;
        }

        input {
            width: 100%;
            padding: 10px;
            margin: 10px 0;
            box-sizing: border-box;
            border: 1px solid #ccc;
            border-radius: 4px;
        }

        label {
            display: block;
            margin-bottom: 8px;
            text-align: left;
        }

        .radio-group {
            display: flex;
            justify-content: space-around;
            margin: 10px 0;
        }

        button {
            background-color: #4caf50;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        button:hover {
            background-color: #45a049;
        }

        a {
            color: #4caf50;
            text-decoration: none;
        }

        .inner-container {
            background-color: rgba(255, 255, 255, 0.8);
            padding: 40px; /* 增加内边距 */
            border-radius: 15px; /* 增加边框圆角 */
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
            margin: 20px; /* 增加外边距 */
        }

    </style>
</head>
<body>
    <div class="login-container">
        <div class="inner-container">
        <h1>点餐系统</h1>
        <form action="/" method="post">
            <label for="username">用户名:</label>
            <input type="text" id="username" name="username" required>

            <label for="password">密码:</label>
            <input type="password" id="password" name="password" required>

            <div class="radio-group">
                <label>
                    <input type="radio" name="user-type" value="admin" checked>
                    管理员
                </label>
                <label>
                    <input type="radio" name="user-type" value="user" checked>
                    用户
                </label>
            </div>
            <button type="submit">登录</button>
        </form>

        <p>还没有账户？<a href="{{ url_for('register') }}">注册</a></p>
        </div>
    </div>

    <!-- 在页面加载完成后触发模态框的显示 -->
    <script>
         document.addEventListener('DOMContentLoaded', function() {
            var messages = {{ get_flashed_messages(with_categories=true) | tojson }};
            messages.forEach(function(item) {

              if (item[0] === 'user_failed' && item[1] === '用户登录失败，请检查用户名和密码') {
                setTimeout(function() {
                  alert("用户登录失败，请检查用户名和密码！");
                }, 100);
              }

              if (item[0] === 'admin_failed' && item[1] === '管理员登录失败，请检查用户名和密码') {
                setTimeout(function() {
                  alert("管理员登录失败，请检查用户名和密码！");
                }, 100);
              }
            });
          });
    </script>




</body>
</html>

<!--消息提醒-->
<!--{% with messages = get_flashed_messages(with_categories=true) %}-->
<!--  {% if messages %}-->
<!--    <ul>-->
<!--      {% for category, message in messages %}-->
<!--        <li class="{{ category }}">{{ message }}</li>-->
<!--      {% endfor %}-->
<!--    </ul>-->
<!--  {% endif %}-->
<!--{% endwith %}-->